﻿<UserControl x:Class="ShellLight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" DataContext="{Binding}">
        <Grid.Background>
            <ImageBrush ImageSource="{Binding BackgroundImageSource}" />
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" />
            <RowDefinition Height="*" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="150" />
        </Grid.ColumnDefinitions>
        
        <StackPanel Grid.Row="0" Grid.Column="0" Background="Black" Orientation="Horizontal" Opacity="0.8">
            <TextBlock Margin="5,0,0,0" VerticalAlignment="Center" Foreground="White" Text="{Binding CommandInFocus.Name}" />
        </StackPanel>
        <StackPanel Grid.Row="0" Grid.Column="1" Background="Black" Orientation="Horizontal" Opacity="0.8">
            <Button Click="CloseCommandButton_Click" Visibility="{Binding CommandInFocusVisibility}" FontSize="8" Margin="130,0,0,0" Padding="0" Width="16" Height="16" Content="x" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Right"></Button>
        </StackPanel>

        <Border Background="White" Opacity="0.95" Visibility="{Binding CommandInFocusVisibility}" Grid.ColumnSpan="2" Grid.Row="1" BorderThickness="2" BorderBrush="Black" CornerRadius="15" Margin="25" Padding="10">
         <ContentControl Content="{Binding CommandInFocus.View}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />
        </Border>
    
        <StackPanel Grid.Row="2" Grid.Column="0" x:Name="taskStackPanel"  Orientation="Horizontal" Background="Black" Opacity="0.8">
            <Button Margin="5" Click="SearchButton_Click" Style="{StaticResource GlassButtonStyle}"  Background="#FFABE3FF" BorderBrush="#FF00AAFF" Height="30" Width="30">
                <Button.Content>
                    <Image Source="Images/logo.png" Height="20" Width="20"></Image>
                </Button.Content>
            </Button>
            <ItemsControl ItemsSource="{Binding ActiveCommands}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" Background="Transparent"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Margin="2" Command="{Binding}" CommandParameter="{Binding Context}">
                            <Button.Content>
                                <Image Source="{Binding IconSource}" Width="30" Height="30" />
                            </Button.Content>
                        </Button>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>

        <StackPanel Grid.Row="2" Grid.Column="1" Background="Black" Opacity="0.8">

            <ItemsControl ItemsSource="{Binding TrayCommands}" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="10">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" Background="Transparent"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Button Command="{Binding}" CommandParameter="{Binding Context}" BorderThickness="0" Background="Transparent">
                            <Button.Content>
                                <Image Source="{Binding IconSource}" Width="16" Height="16" />
                            </Button.Content>
                        </Button>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>
    </Grid>
</UserControl>
